class Computer < ActiveRecord::Base

  validates_presence_of     :name
  validates_presence_of     :os
  validates_presence_of     :room_id
  
  validates_presence_of     :mac_address
  validates_format_of       :mac_address, :with => /^([0-9A-F]{2}:|-){5}([0-9A-F]{2})$/, :message => "should look like an mac address."
    
  validates_presence_of     :ip_address
  validates_format_of       :ip_address, :with => /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/, :message => "should look like an ip address."

  COMPUTER_STATUS = {
    0=>"Inactive",
    1=>"Active",
    2=>"In Operation"
  }
  
  belongs_to :network
  belongs_to :room
  has_and_belongs_to_many :operations
  has_and_belongs_to_many :contacts
  
end
